<?php

$_this =& $this;

/* @var $_this View */
/* @var $form FormHelper */
/* @var $editForm EditFormHelper */
/* @var $html HtmlHelper */
/* @var $ehtml EHtmlHelper */
/* @var $javascript JavascriptHelper */
/* @var $jqax JqaxHelper */
/* @var $filterBlock FilterBlock */

?><?=$editForm->create($modelName, array('url'=>("/{$url_part}/".$this->data[$modelName][$PKName].'/reportings'), 'allowInput' => $this->data[$modelName]['__allows']['update']));?><?php

	?><?=$editForm->startSet();?><?php
		?><?=$editForm->textView(__d($po_domain, 'entity_name', true), $candidate["surname"].' / '.$candidate["name"]);?><?php
		?><?=$editForm->textView(__d($po_domain, 'group', true), $candidate['Group']["name"]);?><?php
	?><?=$editForm->endSet();?><?php

	ob_start();

if (count($reportings)) {

?><table class="table" cellpadding="0"><?php
?><thead><?php
    ?><tr><?php
        ?><th class="nw"><?php
            ?><?=__d($po_domain, 'reportings_date', true);?><?php
        ?></th><?php
        ?><th class="nw"><?php
            ?><?=__d($po_domain, 'testings_test_name', true);?><?php
        ?></th><?php
        ?><th class="nw"><?php
            ?><?=__d($po_domain, 'testings_test_type', true);?><?php
        ?></th><?php
        ?><th class=""><?php
            ?><?=__d($po_domain, 'reportings_testings_date', true);?><?php
        ?></th><?php
        ?><th class="nw"><?php
            ?><?=__d($po_domain, 'reportings_report_name', true);?><?php
        ?></th><?php
        ?><th class="nw"><?php
            ?><?=__d($po_domain, 'reportings_norm_name', true);?><?php
        ?></th><?php
        ?><th class="nw"></th><?php
    ?></tr><?php
?></thead><?php
?><tbody><?php

    $i = 0;
    foreach ($reportings as $item) {

        $class = '';
    	if ($i++ % 2 != 0) {
    		$sep = strlen($class) ? ' ' : '';
    		$class .= $sep.'altrow';
    	}
    	$class = strlen($class) ? ' class="'.$class.'"' : '';

    	$adding_td_class = (isset($active_reporting_id) && ($active_reporting_id == $item['id'])) ? " active-row" : "";
        ?><tr <?=$class;?>><?php
    		?><td class="nw<?=$adding_td_class;?>"><?php
                ?><?=h(Date::Short(Date::SQL2UNIX($item['date']), false));?><?php
            ?></td><?php
    		?><td class="nw<?=$adding_td_class;?>"><?php
                ?><?=h($item['Test']['name']);?><?php
            ?></td><?php
    		?><td class="nw<?=$adding_td_class;?>"><?php
                ?><?=h(__d('tests', 'type_'.$item['Test']['type']));?><?php
            ?></td><?php
    		?><td class="nw<?=$adding_td_class;?>"><?php
                ?><?=h(Date::Short(Date::SQL2UNIX($item['Testing']['pass_date']), false));?><?php
            ?></td><?php
    		?><td class="<?=$adding_td_class;?>"><?php
                ?><?=h($item['Report']['name']);?><?php
            ?></td><?php
    		?><td class="<?=$adding_td_class;?>"><?php
                ?><?=h($item['Norm']['name']);?><?php
            ?></td><?php
            ?><td class="nw actions"><?php
                ?><table class="sys_clear" cellpadding="0"><?php
                ?><tr class="sys_clear"><?php
                 	?><?=$ehtml->iconLink("download", __d(null, 'download', true), "/candidates/{$candidate['id']}/report/{$item['id']}");?><?php
            	?></tr><?php
                ?></table><?php
            ?></td><?php
    	?></tr><?php
    }

?></tbody><?php
?></table><?php

} else {
    ?><span class="additional_msg"><?php
        ?><?=__d($po_domain, 'reportings_List is empty', true);?><?php
    ?></span><?php
}

	$content = ob_get_clean();

    ?><?=$editForm->header(__d($po_domain, 'Reportings_header', true));?><?php
    ?><?=$editForm->cell($content, array('class' => 'non-top-margin'));?><?php

?><?=$editForm->end();?><?php

?>
